<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link href="${pageContext.request.contextPath}/static/assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css"/>
    <link href="${pageContext.request.contextPath}/static/assets/css/codemirror.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/font/css/font-awesome.min.css"/>
    <!--[if lte IE 8]>
		  <%--<link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/ace-ie.min.css" />--%>
		<![endif]-->
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.9.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/typeahead-bs2.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.dataTables.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.dataTables.bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/assets/laydate/laydate.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/lrtk.js" type="text/javascript"></script>
    <title>订单处理</title>
</head>

<body>
<div class="clearfix">
    <div class="handling_style" id="order_hand">
        <div id="scrollsidebar" class="left_Treeview">
            <div class="show_btn" id="rightArrow"><span></span></div>
            <div class="widget-box side_content">
                <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
                <div class="side_list">
                    <div class="widget-header header-color-green2"><h4 class="lighter smaller">订单操作</h4></div>
                    <div class="widget-body">
                        <ul class="b_P_Sort_list">
                            <li><i class="orange  fa fa-reorder"></i><a href="#">全部订单(235)</a></li>
                            <li><i class="fa fa-sticky-note pink "></i> <a href="#">已完成(235)</a></li>
                            <li><i class="fa fa-sticky-note pink "></i> <a href="#">代付款(15)</a></li>
                            <li><i class="fa fa-sticky-note pink "></i> <a href="#">代发货(56)</a></li>
                            <li><i class="fa fa-sticky-note pink "></i> <a href="#">代收货(32)</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="order_list_style" id="order_list_style">
            <div class="search_style">



                <ul class="search_content clearfix">
                    <li><label class="l_f">交易时间</label><input class="inline laydate-icon" id="start"
                                                              style=" margin-left:10px;"></li>
                    <form action="${pageContext.request.contextPath}/transaction/findorderhanding" method="post">
                    <li><label class="l_f">订单编号</label><input name="orderhandingname" type="text" class="text_add" placeholder="输入订单编号"
                                                              style=" width:250px"/></li>

                    <li style="width:90px;">
                        <button type="button" class="btn_search"><i class="fa fa-search"></i>查询</button>
                    </li></form>
                </ul>

            </div>
            <!--交易订单列表-->
            <div class="Orderform_list">
                <table class="table table-striped table-bordered table-hover" id="sample-table">
                    <thead>
                    <tr>
                        <th width="25px"><label><input type="checkbox" class="ace"><span class="lbl"></span></label>
                        </th>
                        <th width="120px">订单编号</th>
                        <th width="250px">收货人</th>
                        <th width="100px">交易金额</th>
                        <th width="100px">交易时间</th>
                        <th width="180px">手机号码</th>
                        <th width="80px">数量</th>
                        <th width="70px">状态</th>
                        <th width="100px">说明</th>
                        <th width="200px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${orderhandingList}" var="handinglist" varStatus="i">
                    <tr>
                        <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
                        <td>${handinglist.order_code}</td>
                        <td class="order_product_name">
                            ${handinglist.order_receiver}
                        </td>
                        <td>${handinglist.sell.sell_sum_price*handinglist.sell.sell_amounts}</td>

                        <td>2016-7-5</td>
                        <td>${handinglist.mobile}</td>
                        <td>${handinglist.sell.sell_amounts}</td>
                        <td class="td-status"><span class="label label-success radius">${handinglist.status}</span></td>
                        <td>
                            <c:if test="${handinglist.status==0}">
                        已付款
                        </c:if>
                        <c:if test="${handinglist.status==1}">
                            待收货
                        </c:if>
                        <c:if test="${handinglist.status==2}">
                            已完成
                        </c:if>
                        </td>


                        <td>
                            <a onClick="Delivery_stop(this,'10001')" href="javascript:;" title="发货"
                               class="btn btn-xs btn-success"><i class="fa fa-cubes bigger-120"></i></a>
                           <%-- <a title="编辑" &lt;%&ndash;onclick="member_edit('${handinglist.order_code}')" href="javascript:;"&ndash;%&gt;
                               class="btn btn-xs btn-info order_detailed"><i
                                    class="fa fa-list bigger-120"></i></a>
                            <a title="删除" href="javascript:;" &lt;%&ndash;onclick="member_edit('${handinglist.order_code}')"&ndash;%&gt;
                               &lt;%&ndash;href="${pageContext.request.contextPath}/transaction/delhanding?order_code=${handinglist.order_code}"&ndash;%&gt;
                               class="btn btn-xs btn-warning"><i class="fa fa-trash  bigger-120"></i></a>--%>
                        </td>
                    </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!--发货-->
<div id="Delivery_stop" style=" display:none">
    <div class="">
        <div class="content_style">
            <div class="form-group"><label class="col-sm-2 control-label no-padding-right"
                                           >订单状态 </label>
                <div class="col-sm-9"><select class="form-control" id="form-field-select-1">
                    <option value="">--选择订单状态--</option>
                    <option value="1">已付款</option>
                    <option value="2">待收货</option>
                    <option value="3">已完成</option>
                </select></div>
            </div>
            <div class="form-group"><label class="col-sm-2 control-label no-padding-right"
                                           >快递公司 </label>
                <div class="col-sm-9"><select class="form-control" id="form-field-select-2">
                    <option value="">--选择快递--</option>
                    <option value="1">天天快递</option>
                    <option value="2">圆通快递</option>
                    <option value="3">中通快递</option>
                    <option value="4">顺丰快递</option>
                    <option value="5">申通快递</option>
                    <option value="6">邮政EMS</option>
                    <option value="7">邮政小包</option>
                    <option value="8">韵达快递</option>
                </select></div>
            </div>
        </div>
    </div>
</div>
</body>
<%--<div class="add_menber" id="add_menber_style" style="display:none">

    <ul class=" page-content">
        <li><label class="label_name">订单编号：</label><span class="add_name"><input value="${product1.product_id}" name="product_id"
                                                                                 type="text"
                                                                                 class="text_add" /></span>
            <div class="prompt r_f"></div>
        </li>

        <li><label class="label_name">收货人：</label><span class="add_name"><input value="${product1.product_name}"  name="product_name" type="text"
                                                                                 class="text_add"/></span>
            <div class="prompt r_f"></div>
        </li>
        <li><label class="label_name">交易金额：</label><span class="add_name"><input value="${product1.product_s_price}" name="product_s_price" type="text"
                                                                                                        class="text_add"/></span>
            <div class="prompt r_f"></div>
        </li>
        <li><label class="label_name">手机号码：</label><span class="add_name"><input value="${product1.product_price}"  name="product_price" type="text"
                                                                                                       class="text_add"/></span>
            <div class="prompt r_f"></div>
        </li>
        <li><label class="label_name">数量：</label><span class="add_name"><input value="${product1.product_price}"  name="product_price" type="text"
                                                                                 class="text_add"/></span>
            <div class="prompt r_f"></div>
        </li>

    </ul>
</div>--%>
</html>
<script>
    $(function () {
        $("#order_hand").fix({
            float: 'left',
            //minStatue : true,
            skin: 'green',
            durationTime: false,
            spacingw: 30,//设置隐藏时的距离
            spacingh: 250,//设置显示时间距
            table_menu: '.order_list_style',
        });
    });

    //时间
    laydate({
        elem: '#start',
        event: 'focus'
    });
    //初始化宽度、高度
    $(".widget-box").height($(window).height());
    $(".order_list_style").width($(window).width() - 220);
    $(".order_list_style").height($(window).height() - 30);
    //当文档窗口发生改变时 触发
    $(window).resize(function () {
        $(".widget-box").height($(window).height());
        $(".order_list_style").width($(window).width() - 234);
        $(".order_list_style").height($(window).height() - 30);
    });

    /**发货**/
    function Delivery_stop(obj, id) {
        layer.open({
            type: 1,
            title: '发货',
            maxmin: true,
            shadeClose: false,
            area: ['500px', ''],
            content: $('#Delivery_stop'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                if ($('#form-field-1').val() == "") {
                    layer.alert('快递号不能为空！', {
                        title: '提示框',
                        icon: 0,
                    })

                } else {
                    layer.confirm('提交成功！', function (index) {
                        $(obj).parents("tr").find(".td-manage").prepend('<a style=" display:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="已发货"><i class="fa fa-cubes bigger-120"></i></a>');
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发货</span>');
                        $(obj).remove();
                        layer.msg('已发货!', {icon: 6, time: 1000});
                    });
                    layer.close(index);
                }

            }
        })
    };
/*
    /!**发货**!/
    function Delivery_stop(obj, id) {
        layer.open({
            type: 1,
            title: '发货',
            maxmin: true,
            shadeClose: false,
            area: ['500px', ''],
            content: $('#Delivery_stop'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                if ($('#form-field-1').val() == "") {
                    layer.alert('快递号不能为空！', {
                        title: '提示框',
                        icon: 0,
                    })

                } else {
                    layer.confirm('提交成功！', function (index) {
                        $(obj).parents("tr").find(".td-manage").prepend('<a style=" display:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="已发货"><i class="fa fa-cubes bigger-120"></i></a>');
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发货</span>');
                        $(obj).remove();
                        layer.msg('已发货!', {icon: 6, time: 1000});
                    });
                    layer.close(index);
                }

            }
        })
    };
*/
    /*订单处理-编辑*/
    /*function member_edit(order_id) {
        alert(order_id);
        var pathName=document.location.pathname;
        console.log("pathName="+pathName);
        var index=pathName.substr(1).indexOf("/");
        var result=pathName.substr(0,index+1);
        console.log(result);
        alert(result);

        $.ajax({
            url:result+"/transaction/edit2",
            type:"get",
            data:{order_id:order_id},
            dataType:"json",
            success:function (data) {
                if (data.success) {
                    layer.open({
                        type: 1,
                        title: '修改用户信息',
                        maxmin: true,
                        shadeClose: false, //点击遮罩关闭层
                        area: ['800px', ''],
                        content: $('#update_menber_style'),
                        btn: ['提交', '取消'],
                        yes: function (index, layero) {
                            var num = 0;
                            var str = "";
                            $(".add_menber input[type$='text']").each(function (n) {

                                //alert($(this).val());
                                //alert(n);
                                if ($(this).val() == "") {

                                    layer.alert(str += "" + $(this).attr("name") + "不能为空！\r\n", {
                                        title: '提示框',
                                        icon: 0,
                                    });
                                    num++;
                                    return false;
                                }
                            });

                            var order_id=$('input[name="order_id"]').val();
                            console.log("order_id="+order_id);

                            var order_code=$('input[name="order_code"]').val();
                            console.log("order_code="+order_code);

                            /!*var zsex=$('input[name="form-field-radio"]:checked').val();
                            console.log("zsex="+zsex);
*!/
                            var order_receiver=$('input[name="order_receiver"]').val();
                            console.log("order_receiver="+order_receiver);

                            var sell_sum_price=$('input[name="sell_sum_price"]').val();
                            console.log("sell_sum_price="+sell_sum_price);

                            var sell_amounts=$('input[name="sell_amounts"]').val();
                            console.log("sell_amounts="+sell_amounts);

                            var mobile=$('input[name="mobile"]').val();
                            console.log("mobile="+mobile);

                            if (num > 0) {
                                return false;
                            } else {
                                $.ajax({
                                    url:result+"/user/updateUser",
                                    type:"get",
                                    data:{
                                        order_id:order_id,
                                        order_code:order_code,
                                        order_receiver:order_receiver,
                                        sell_sum_price:sell_sum_price,
                                        sell_amounts:sell_amounts,
                                        mobile:mobile
                                    },
                                    dataType:"json",
                                    success:function (data) {
                                        if (data.success) {

                                            alert(num);
                                            layer.alert('修改成功！', {
                                                title: '提示框',
                                                icon: 1,
                                            });

                                            layer.close(index);


                                        }else {
                                            alert("修改失败");
                                        }
                                    }
                                })


                            }
                        }
                    });
                }else{
                    alert("修改失败");
                }
            }
        })



    }*/

    //订单列表
    jQuery(function ($) {
        var oTable1 = $('#sample-table').dataTable({
            "aaSorting": [[1, "desc"]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable": false, "aTargets": [0, 2, 3, 4, 5, 6, 8, 9]}// 制定列不参与排序
            ]
        });
        //全选操作
        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });
    });
</script>
